/**
 * 
 */
package com.css.crm.dao.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.css.crm.dao.CustomerAddressDao;
import com.css.crm.vo.CustomerAddressVo;

/**
 * Implementation for CustomerAddressDao
 * 
 * @author AIS
 * 
 */
public class CustomerAddressDaoImpl extends BaseDaoImpl implements CustomerAddressDao {

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.css.crm.dao.CustomerAddressDao#getCustomerAddressByPK(java.lang.String
	 * )
	 */
	@Override
	public CustomerAddressVo getCustomerAddressByPK(String custAddrId) {
		SqlSession session = getMyBatisSession();
		return session.selectOne("customerAddress.getCustomerAddressByPK", custAddrId);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.css.crm.dao.CustomerAddressDao#getCustomerAddressByCustId(java.lang
	 * .String)
	 */
	@Override
	public List<CustomerAddressVo> getCustomerAddressByCustId(String custId) {
		SqlSession session = getMyBatisSession();
		return session.selectList("customerAddress.getCustomerAddressByCustId", custId);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.css.crm.dao.CustomerAddressDao#insertCustomerAddress(com.css.crm.
	 * vo.CustomerAddressVo)
	 */
	@Override
	public int insertCustomerAddress(CustomerAddressVo customerAddress) {
		SqlSession session = getMyBatisSession();
		return session.insert("customerAddress.insertCustomerAddress", customerAddress);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.css.crm.dao.CustomerAddressDao#updateCustomerAddressByPK(com.css.
	 * crm.vo.CustomerAddressVo)
	 */
	@Override
	public int updateCustomerAddressByPK(CustomerAddressVo customerAddress) {
		SqlSession session = getMyBatisSession();
		return session.update("customerAddress.updateCustomerAddressByPK", customerAddress);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.css.crm.dao.CustomerAddressDao#deleteCustomerAddressByPK(java.lang
	 * .Long)
	 */
	@Override
	public int deleteCustomerAddressByPK(Long custAddrId) {
		SqlSession session = getMyBatisSession();
		return session.delete("customerAddress.deleteCustomerAddressByPK", custAddrId);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.css.crm.dao.CustomerAddressDao#deleteCustomerAddressByCustId(java
	 * .lang.String)
	 */
	@Override
	public int deleteCustomerAddressByCustId(String custId) {
		SqlSession session = getMyBatisSession();
		return session.delete("customerAddress.deleteCustomerAddressByCustId", custId);
	}

}
